#pragma once

#include "Manifestation.h"

#include "PackageableElement.h"

namespace uml {

Manifestation::Manifestation(const QString& umlType)
    : Abstraction(umlType) {}

void Manifestation::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    Abstraction::fromJson(json, errorList);
    utilizedElement_ = JsonSerializable::create<PackageableElement>(json.value("utilizedElement"), errorList);

}

void Manifestation::toJson(QJsonObject& json) {
    Abstraction::toJson(json);
    if (utilizedElement_) {
        QJsonObject utilizedElement_json;
        utilizedElement_->toJson(utilizedElement_json);
        json.insert("utilizedElement", utilizedElement_json);
    }
}

/// <summary>
/// utilizedElement getter
/// The model element that is utilized in the manifestation in an Artifact.
/// </summary>
shared_ptr<PackageableElement> Manifestation::utilizedElement() const {
    return utilizedElement_;
}

/// <summary>
/// utilizedElement setter
/// The model element that is utilized in the manifestation in an Artifact.
/// </summary>
void Manifestation::setUtilizedElement(shared_ptr<PackageableElement> value) {
    utilizedElement_ = value;
}

} // namespace uml
